<?php 
include "includes/session.php";
include "includes/comunes.php";
require_once("includes/paginator.class.php");
$pages = new Paginator;

$sql="select * from  personas ";
//armo el Where de la consutla
$where=" where 1 ";

if($_POST['vendedor']<>""){
	$ven=explode('-',$_POST['vendedor']);
     $where.=" and personaId =".(int)$ven[0];
}


$where.=" order by personaNombre desc "   ;
 


//realizo la consulta paro obtener los totales

$result= cons_sql_up($sql.$where);
//finc consulta

$pages->items_total = mysql_num_rows($result);
$pages->mid_range = 9;
$pages->paginate();
$result=  $result= cons_sql_up($sql.$where.$pages->limit);
//echo $sql.$where.$pages->limit;die();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta HTTP-EQUIV="refresh" CONTENT="300"/>
<title>Sistema de Gestion de Vehiculos</title>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="estilos.css" rel="stylesheet" type="text/css" />

<!--libreria jquery central-->

<script src="jquery-ui/js/jquery-1.9.1.js"></script>
<!--fin libreria central-->

<!--Librerias para el combo-->
<script language="JavaScript" type="text/javascript" src="combos/jquery.chainedSelects.js"></script>
<!--fin libreria-->

<!--librerias ui-->
<link href="jquery-ui/css/ui-lightness/jquery-ui-1.10.2.custom.css" rel="stylesheet"/>
<script src="jquery-ui/js/jquery-ui-1.10.2.custom.js"></script>
<!--fin libreria-->
<!--libreria flexigrid-->
<link rel="stylesheet" type="text/css" href="jquery-ui/css/ui-flexigrid/flexigrid.css">
    <script type="text/javascript" src="jquery-ui/js/flexigrid.js"></script>
<!--fin libreria-->



<script language="JavaScript" type="text/javascript">
$(function()
{

//        funcion que implementa combos
	$('#marca').chainSelect('#modelo','combomarcamodelo.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
        
        $('#modelo').chainSelect('#version','combomodeloversion.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
        
        
           $('#venpro').chainSelect('#venloc','comboprolocalidad.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
        
//        fin funcion

//          funcion datapicker

     <!--  $( "#fechad" ).datepicker({
       //  dateFormat: "yy-mm-dd"
//
//      });
//	  
//	  $( "#fechah" ).datepicker({
//         dateFormat: "yy-mm-dd"
//
//      });-->
       
//             funcion

//funcion autocomplete
   
		
		   $( "#vendedor" ).autocomplete({
			source: "autoAccionista.php"
		});


//fin funcion




  $('#flex1').flexigrid({
      colModel : [
                
		{display: 'Nro.', name : 'accionistaId', width : 40, sortable : true, align: 'center'},
		{display: 'DNI', name : 'dni', width : 100, sortable : true, align: 'left'},
		{display: 'Nombre y Apellido', name : 'nomyape', width : 150, sortable : true, align: 'left'},
		{display: 'Tel.Fijo', name : 'fecha', width : 60, sortable : true, align: 'left'},
		{display: 'Tel.Cel.', name : 'fecha', width : 60, sortable : true, align: 'left'},
	
                {display: 'Acciones', name : 'acciones', width : 105, sortable : false, align: 'left'}
		],
                width: 450,
                height: 1000
              
  });
<?php for ($i=1;$i<30;$i++):?>
  $('#fila<?php echo $i?>').tooltip({
      track: true
    });
 
<?php endfor?>
<?php for ($i=1;$i<30;$i++):?>
  $('#visualizar<?php echo $i?>').tooltip({
      track: true
    });

<?php endfor?>
 <?php for ($i=1;$i<30;$i++):?>
  $('#editar<?php echo $i?>').tooltip({
      track: true
    });

<?php endfor?>
<?php for ($i=1;$i<30;$i++):?>
  $('#imprimir<?php echo $i?>').tooltip({
      track: true
    });

<?php endfor?>
<?php for ($i=1;$i<30;$i++):?>
  $('#tratar<?php echo $i?>').tooltip({
      track: true
    });

<?php endfor?>
});
</script>



</head>

<body>

<div class="container">
<?php include "includes/head.php"?>
   <div class="content">
       <div class="tituloprincipal">
           <?php include 'includes/submenu.php';?>  
           <img src="img/pedidos.jpg" width="25" height="25" border="0"/> Listado de Contactos
           </div>
       
       <div class="contenedorpedido">
       <form id="boletocompra" name="boletocompra" method="POST" action="ListadoAgenda.php">
        <fieldset>
             <legend><b>Seleccione Filtros</b></legend>
             <table width="100%">
                 
                 
 <tr>
                      <td class="textotablamenuform">Contacto</td>
                    <td class="textotablamenuform" colspan="5"><input type="text" name="vendedor" id="vendedor" value="" class="campo_form" /></td>
                       
                        </tr>
                 <tr>
<!--                    <td class="textotablamenuform">Sucursal</td>
                    <td class="textotablamenuform" ><select name="sucursal" id="sucursal" class="campo_form">
                      <option selected="selected" value="0">Todos...</option>
                      <?php
//                             $ped=obtener_sucursales();

//                             while($regPed=mysql_fetch_array($ped)){
//                                 
//                                       echo "<option value='".utf8_encode($regPed['sucursalId'])."'>".utf8_encode($regPed['sucursalNombre'])." (".utf8_encode($regPed['sucursalCodigo']).")</option>";
//
//
//                             }

                             ?>
                    </select></td>-->
                 </tr>
                   <tr>
                    <td class="textotablamenuform" style="text-align: right;" colspan="8">
                         <input type="reset" name="enviar" value="Limpiar"  class="boton_form"/>
                         <input name="submit" id="submit" type="submit" value="Realizar Busqueda" class="boton_form"/>
                     </td>
                 </tr>
             </table>
        </fieldset>
       </form>
           <fieldset>
             <legend><b>Resultado de la Busqueda</b></legend>
             <a href="altaPersona.php"><img src="img/nuevo.png" width="25" height="25" border="0"/> Nuevo Contacto</a>
             </br>

             <table id="flex1" style="display:none;">

               <tbody>

                <?php
                $i=1;
                if($pages->items_total >0)
                while($reg=  mysql_fetch_array($result)):?>
                  <tr id="fila<?php echo $i?>">
                     
                     <td><?php echo $reg['personaId']?></td>
                     <td><?php echo $reg['personaDniCuit']?></td>
                     <td><?php echo $reg['personaNombre']?></td>
                     <td> <?php echo $reg['personaTelefonoFijo']?></td>
                     <td> <?php echo $reg['personaTelefonoCelular']?></td>
                   
                     <td>
                     <a href="visualizarPersona.php?per_id=<?php echo $reg['personaId']?>" ><img src="jquery-ui/css/ui-flexigrid/images/magnifier.png" border="0" width="25px" id="visualizar<?php echo $i?>" title="Visualizar Datos de Contacto <?php echo $reg['personaId']?>"></a>
                     <a href="modificarPersona.php?per_id=<?php echo $reg['personaId']?>" ><img src="img/editar.png" border="0" width="25px" id="actualizar<?php echo $i?>" title="Actualizar Datos de Contacto<?php echo $reg['personaId']?>"></a>
                     
					 <!--<a href="imprimirBoleto.php?bol_id=<?php //echo $reg['personaId']?>"><img src="img/imprimir.png" border="0" width="25px" id="imprimir<?php //echo $i?>" title="Imprimir Boleto de Compra <?php //echo $reg['boletoId']?>"></a> 
                      <a href="ListadoMovEfectivo.php?per_id=<?php //echo $reg['personaId']?>" ><img src="img/movimientos.jpg" border="0" width="25px" id="movimientos<?php// echo $i?>" title="Registrar Movimientos de <?php //echo $reg['personaNombre']?>"></a>-->
                     
                  </tr>
                 <?php
                 $i++;
                 endwhile
                
                 ?>

                   <tr>
                       <td colspan="8"><?php echo $pages->display_jump_menu();echo $pages->display_items_per_page();echo $pages->display_pages() ?></td>
                   </tr>
                </tbody>

             </table>
             

        </fieldset>
           
       </div>
 
       <div class="clear"></div>
   <br>
   </div>
  <?php include "includes/pie.php"?>
  
</div>
</body>
</html>
